Variable transfer rate control coding apparatus

ABSTRACT

A variable transfer rate coding apparatus codes moving picture signals of groups of pictures (GOPs). The picture signals are quantized under control of quantization step width and coded. A first code amount per GOP and a second code amount of picture data included GOP are obtained from the coded picture signals. In response to the first code amount, a total code amount of the picture signals of the GOPs are calculated and the total code amount is compared with a reference total code amount, to decide a first target code amount per GOP in order that the total code amount becomes a maximum amount within the reference total code amount. Further, in response to the first target code amount and the second code amount, a second target code amount of the picture data included in each GOP is determined in accordance with the maximum amount. The quantization step width is varied on the basis of the second target code amount.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a variable transfer rate control codingapparatus (variable bit coding apparatus) for efficiently coding signalsby use of a smaller amount of codes in a digital recording apparatus,and more specifically to a coding apparatus for coding moving picturesignals by controlling the transfer rate, that is, the code amount perunit time.

2. Description of the Prior Art

In the high efficiency coding of picture signals, the variable lengthcoding technique is effective and reasonable, because a part of apicture having a small amount of picture data can be coded by use of asmaller amount of codes. In particular, in the case of the interpictureprediction coding in unit of frame or field of moving picture, theamount of codes (often referred to as code amount simply, hereinafter)can be extremely reduced in the motion-less portion of the movingpicture. Therefore, it is possible to increase the transmission andrecording efficiency when the transfer rate (the code amount per unittime) are varied according to the contents of picture, on condition thatthe quality of the moving picture is roughly kept constant.

FIG. 1 is a block diagram showing a prior art variable transfer ratecoding apparatus. In this prior art coding apparatus, the codingprocessing is executed twice for the same moving picture signals. Thatis, the first coding is executed in a temporal coding to determine atarget transfer rate (a target code amount per unit time), and thesecond coding is executed in an actual coding. .[.<Temporal coding>.].

.Iadd.Temporal Coding .Iaddend.

In FIG. 1, A designates composing elements for executing the temporalcoding, by which temporal code amounts of moving picture signals can beobtained. At this temporal coding, two selectors 11 and 18 are bothswitched to the a-side.

Picture signals outputted by a picture signal source 1 are inputted to apredict subtracter 2 and an activity detector 5.

Here, since the same picture signals are supplied twice to the codingsection, all the picture signals before coding are recorded in a picturerecording medium of a large capacity such as VTR. As the picturerecording medium, any media such as memory elements, optical disk, HDD,etc. can be used, as far as the recording capacity is large enough.

In the predict subtracter 2, the inter-frame prediction signals(sometimes referred to as prediction signals, hereinafter) inputted froman inter-picture predictor 10 is subtracted from the picture signals.The subtracted results are inputted to a discrete cosine transformer(DCT) 3 as prediction residual signals.

The prediction residual signals are discrete-cosine transformed(referred to as DCTed, hereinafter) by the DCT 3. The DCTed signals aregiven to a quantizer 4. In the quantizer 4, the DCTed signals arequantized according to quantization control data (quantization stepwidth/quantization scale) inputted by a quantize controller 6. Thesequantized signals are inputted to a variable length coder 7 and a localdecoder 8.

In the local decoder 8, the quantized signals are inversely quantizedand further inversely DCTed, that is, the codes are decoded asreproduced prediction residual signals. The decoded signals are inputtedto an adder 9. In the adder 9, the inter-frame prediction signalsinputted by the inter-picture predictor 10 and the reproduced predictionresidual signals inputted by the local decoder 8 are added to obtain thereproduced picture signals. The obtained reproduced picture signals aresupplied again to the inter-picture predictor 10.

Here, the inter-picture predictor 10 compensates for the reproducedpicture signals by delaying the motion thereof by one frame, to generateinter-frame prediction signals. The generated inter-frame predictionsignals are supplied to the predict subtracter 2 and the adder 9.

To the quantize controller 6, a reference quantization step width (apredetermined fixed value) is inputted through the selector 18 switchedto the a-side, and further an activity for each picture signal block isinputted from the activity detector 5.

Here, the activity represents the degree of change for each block of thepicture signals. Further, the picture signal block represents a block ofpicture signals partitioned in unit of a predetermined size pixel (e.g.,8×8 pixels).

In the quantize controller 6, the quantization step width is setaccording to the activity value, and the set quantization step widthvalue is outputted to the quantizer 4 as quantization control data.

In the above-mentioned quantization control, the quantization step widthis determined on the basis of the activity, in such a way as to becomecoarse when the activity is large but fine when small. The reason is asfollows: in a block of a large activity, since the pictures changelargely, even a relatively large coding error is not noticeable. On theother hand, in a block of a small activity, since the pictures changeslightly, even a relatively small coding error is easily noticeable.

As described above, when the picture signal activity is adopted for thequantization control, it is possible to generate picture signals of acode amount for each block in such a way that the picture quality can beuniformalized form the visual standpoint.

Here, as the activity value, it is possible to use the dispersion ofpixel values, the absolute addition of the prediction error values, theabsolute addition of orthogonal transform coefficients, etc. .[.<Totalcode amount control>.].

.Iadd.Total Code Amount Control .Iaddend.

The variable length coder 7 codes the signals quantized by the quantizer4 in way of variable length, and outputs the coded data whose dataamount is compressed.

The data coded by the variable length coder 7 are inputted to a temporalcode amount counter 12 via the selector 11 switched to the a-side. Inthe temporal code amount counter 12, the generated code amount iscounted for each unit of time, and the counted code amount is inputtedto a code amount converter 13 and a temporal code amount memory 14. Inthe temporal code amount memory 14, the temporal code amount used foreach unit time in the actual coding (described later) is stored.

The code amount converter 13 is constructed as shown in FIG. 2. The codeamount converter 13 decides the conversion characteristics forconverting the temporal transfer rate (temporal code amount per unittime) into the target transfer rate. On the basis of the decidedconversion characteristics, the total code amount of the whole movingpicture signals can be controlled.

In more detail, in FIG. 2, the temporal code amount inputted through atemporal code amount input terminal 58 is converted by n-units oftransfer rate converters (referred to as converters, hereinafter) 61,62, . . . , 64 having n-units of different conversion characteristics. Aplurality of transfer rates for each time unit converted in accordancewith each of the conversion characteristics are added by each ofaccumulate adders 65, 66, . . . 68 over the entire duration of themoving picture, so that the total code amount of the whole movingpicture can be obtained for each transfer rate converter.

Upon completion of the temporal coding, the total code amounts of therespective transfer rate converters 1 to n accumulated by the respectiveaccumulate adders 65 to 68 are inputted to comparators 69, 70, . . . 72,respectively and further compared with the target total code amountdetermined on the basis of the recordable capacity of the recordingmedium. The compared results are inputted to a discriminator 73 fordiscriminating the comparison results of a plurality of the comparators69, 70, . . . 72.

The discriminator 73 discriminates or selects the conversioncharacteristics which can convert the temporal code amount into themaximum total code amount less than the target total code amount (therecordable capacity of the medium), from among the respective total codeamounts outputted from the respective accumulate adders 65, 66, 67, . .. 68. The selected conversion characteristics are inputted to a targettransfer rate setter 15 of FIG. 1 through a conversion characteristicsdata output terminal 59.

FIG. 3 shows an example of the conversion characteristics of theconverters 1 to n, respectively, in which the relationship between thetemporal transfer rate (temporal code amount per unit time) and thetarget transfer rate is shown.

As shown in FIG. 3, an upper limit (Dmax) of the outputs of the transferrate converters are first decided. This is because the recording mediumand the decoder have an upper limit of the processing ability, so thatthe maximum transfer rate is determined on the basis of the upper limitsof these elements. Therefore, although the variable transfer rates areadopted, a maximum target transfer rate is to be fixed to a value.

As shown in FIG. 3, the conversion characteristics of the transfer rateconverters are determined to be logarithmic characteristics, forinstance, so that the fluctuations of each of the target transfer ratescan be suppressed as a whole. In other words, although each targettransfer rate is generally controlled gently, since the picture qualitydeteriorates from the visual point of view in a part of picture wherethe temporal code amount per unit time is relatively small, the codeamount is somewhat increased. .[.<Actual coding>.].

.Iadd.Actual Coding .Iaddend.

In FIG. 1, B indicates a composing section for actual coding. In thissection, the coding is executed by controlling the amount of generatedcodes so that the actual transfer rate approaches the target transferrate for each unit time. In this operation, the selectors 11 and 18 areboth switched to the b-side, respectively.

In FIG. 1, the picture signals the same as with the case of the temporalcoding are outputted again from the picture signal source 1, and furthercoded in the same way as the temporal coding. Here, the predictsubtracter 2, the orthogonal converter 3, the quantizer 4, the activitydetector 5, the quantize controller 6, the variable code length coder 7,the local decoder 8, the adder 9 and the inter-picture predictor 10 alloperate in the same way as with the case of the temporal coding, exceptthe contents of the respective operation.

That is, in the actual coding, the output of the variable length coder 7is inputted to a buffer 16 through the selector 11 switched to theb-side. Since the data inputted to the buffer 16 has been coded invariable length, although the amount of generated codes always varies,since the variation thereof can be absorbed by the buffer 16, the codeddata of a fixed transfer rate can be outputted to a decoder (not shown)through a code output terminal 28.

The read rate at which the codes are read from the buffer 16 iscontrolled for each unit of time by data supplied by a target transferrate setter 15. Therefore, the code amount outputted from the buffer 16changes for each unit time. In the target transfer rate setter 15, thetemporal code amount inputted from the temporal code amount memory 14for each unit time is converted in accordance with the conversioncharacteristics inputted from the code amount converter 13, so that thetarget transfer rate can be determined.

On the other hand, the occupancy data of the buffer 16 is inputted tothe quantize controller 6 via the selector 18 switched to the b-side.

In the quantize controller 6, the quantization step width is determinedaccording to the inputted occupancy data of the buffer 16 and theactivity (the degree of change in picture signals for each block)obtained by the activity detector 5. The determined quantization stepwidth is inputted to the quantizer 4.

Further, FIG. 4 shows an example of the relationship between the bufferoccupancy and the quantization step width, which is used for thequantization control.

In the above-mentioned prior art coding apparatus, the target transferrate has been determined on the basis of the amount of codes generatedin unit of several pictures in the actual coding operation, and furtherthe quantization step width has been determined on the basis of thebuffer occupancy.

In this case, since the relationship between the buffer occupancy andthe quantization step width is determined as shown in FIG. 4, when thebuffer 16 is full (i.e., many codes are stored), the quantization stepwidth changes coarsely and when empty (i.e., small codes are stored),the quantization step width changes finely.

In the prior art coding apparatus, however, since the quantization stepwidth is determined for each block according to the buffer occupancy,there exists a problem in that the quantization step width changeslargely according to the change in the amount of generated codes, withthe result that the picture quality is not stable and varies noticeably.

SUMMARY OF THE INVENTION

With these problems in mind, therefore, it is the object of the presentinvention to provide a coding apparatus which can determine anappropriate amount of codes easily so that the picture quality can beimproved by uniformalizing the picture quality.

To achieve the above-mentioned object, the present invention provides avariable transfer rate coding apparatus for coding moving picturesignals of groups of pictures, comprising: a quantizer for quantizingthe picture signals under control of quantization step width: a coderfor coding the quantized picture signals; code amount obtaining meansfor obtaining a first code amount of the coded picture signals per groupof pictures and a second code amount of picture data included per groupof pictures; first determining means, in response to the first codeamount, for calculating a total code amount of the picture signals ofthe groups of pictures and comparing the total code amount with areference total code amount, to decide a first target code amount pergroup of pictures in order that the total code amount becomes a maximumamount within the reference total code amount; second determining means,in response to the first target code amount and the second code amount,for determining a second target code amount of the picture data includedin each group of pictures in accordance with the maximum amount; andcontrol means for varying the quantization step width on the basis ofthe second target code amount.

The code amount obtaining means may comprise: first counting means, inresponse to the coded picture signals per group of pictures, forsequentially counting code amounts of blocks per picture; secondcounting means, in response to the code amounts of blocks, forsequentially counting code amounts of pictures in each group; and thirdcounting means, in response to the code amounts of pictures, forcounting the first code amounts, wherein at least either of a codeamount of a block or a picture is obtained as the second code amount.

The first determining means may comprise: converting means forsequentially converting the first code amount per group of pictures intodifferent code amounts by means of different conversion characteristics;accumulating means for accumulating each different code amount per groupof pictures over the groups of pictures to generate different total codeamounts of the groups of pictures under the different conversioncharacteristics; comparing means for comparing each of the differenttotal code amounts with the maximum total code amount; and thirddetermining means for determining which one of the different total codeamounts is the largest and the closest to the maximum total code amount,to output one of the conversion characteristics corresponding to thedetermined total code amount as the first target code amount, thus thesecond determining means converting the second code amount into thesecond target code amount by means of the outputted conversioncharacteristics.

The variable transfer rate coding apparatus may further comprisescomparing means for comparing the first code amount with the secondtarget code amount to output quantization step width information foreach block of a picture, thus the control means varying the quantizationstep width on the basis of the quantization step width information. Thecomparing means may comprise: detecting means, in response to the codedpicture signals, for detecting a code amount of each block; subtractingmeans for subtracting the detected code amount from the second targetcode amount; first comparing means for comparing a subtraction result ofthe subtracting means with a reference positive value and outputting afirst comparison signal when the subtraction result is positive andgrater than the reference positive value; second comparing means forcomparing the subtraction result with a reference negative value andoutputting a second comparison signal when the subtraction result isnegative and grater than the reference negative value; and means, inresponse to the first comparison signal, for outputting a firstquantization step width information, thus the control means narrowingthe quantization step width, while in response to the second comparisonsignal, for outputting a second quantization step width information,thus the control means widening the quantization step width.

The above and other related objects and features of the invention willbe apparent from a reading of the following description of thedisclosure found in the accompanying drawings and the novelty thereofpointed out in the appended claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a prior art variable transfer ratecoding apparatus;

FIG. 2 is a block diagram showing a code amount converter 13 of theprior art coding apparatus shown in FIG. 1;

FIG. 3 is a graphical representation showing the conversioncharacteristics between the temporal transfer rate (the temporal codeamount per unit time) and the target transfer rate;

FIG. 4 is a graphical representation showing the way of controlling thequantization, that is, the relationship between the buffer occupancy andthe quantization step width of the prior art coding apparatus;

FIG. 5 is a block diagram showing an embodiment of the variable transferrate coding apparatus according to the present invention;

FIG. 6 is a block diagram showing a temporal code amount counter 19 anda temporal code amount memory 20 of the coding apparatus according tothe present invention shown in FIG. 5;

FIG. 7 is an illustration for assistance in explaining the coded picturesignals related to the present invention;

FIG. 8 is a graphical representation showing an example of theconversion characteristics between the GOP temporal transfer rate andthe target transfer rate related to the present invention;

FIG. 9 is another graphical representation showing another example ofthe conversion characteristics between the GOP temporal transfer rateand the target transfer rate related to the present invention;

FIG. 10 is an illustration for assistance in explaining the operation ofthe target code amount converter of the coding apparatus shown in FIG. 5according to the present invention;

FIG. 11 is a block diagram showing a code amount comparator 24 of thecoding apparatus shown in FIG. 5 according to the present invention; and

FIG. 12 is a block diagram showing a code amount converter 113 of thecoding apparatus according to the present invention shown in FIG.5.

DETAILED DESCRIPTION OF THE EMBODIMENTS

A preferred embodiment of the present invention will be describedhereinbelow in detail with reference to the attached drawings.

FIG. 5 shows an embodiment of the variable transfer rate codingapparatus according to the present invention, in which the samereference numerals have been retained for the similar elements whichhave the same functions as with the case of the prior art codingapparatus shown in FIG. 1.

The major difference between the coding apparatus of the presentinvention shown in FIG. 5 and the prior art coding apparatus shown inFIG. 1 is that there are additionally provided a temporal code amountcounter 19, a temporal code amount memory 20, a target code amountconverter 22, a target code amount memory 23, a code amount comparator24, a quantization step width setter 25, a switch 26 and a code amountconverter 113.

In FIG. 5, the coding apparatus comprises a picture signal source 1, apredict subtracter 2, a DCT 3, a quantizer 4, an activity detector 5, avariable length coder 7, a local decoder 8, an adder 9, a predictor 10,two selectors 11 and 18, a target transfer rate setter 15, a buffer 16,a code output terminal 28 (in the same way as with the case of the priorart apparatus), and additional above-mentioned elements such as thetemporal code amount counter 19 (shown in FIG. 6 as a practicalexample), the temporal code amount memory 20 (shown in FIG. 6 as apractical example), the target code amount converter 22, the target codeamount memory 23, the code amount comparator 24, the quantization stepwidth setter 25, the switch 26 and the code amount converter 113.

In the coding apparatus shown in FIG. 5, the coding processing isexecuted twice for the same moving picture signals. .[.<Temporalcoding>.].

.Iadd.Temporal Coding .Iaddend.

In FIG. 5, A designates a composing section provided for the temporalcoding, by which temporal code amount of moving picture signals can beobtained. At this temporal coding, two selectors 11 and 18 are bothswitched to the a-side and the switch 26 is turned off.

Picture signals outputted by the picture signal source 1 are inputted tothe predict subtracter 2 and the active detector 5.

Here, since the same picture signals are supplied twice to the codingsection, all the picture signals before coding are recorded in a picturerecording medium of a large capacity such as VTR. As the picturerecording medium, any media such as memory elements, optical disk, HDD,etc. can be used, as far as the recording capacity is large enough.

In the predict subtracter 2, inter-frame prediction signals inputted byan inter-picture predictor 10 are subtracted from the picture signals.The subtracted results are inputted to the DCT 3 as the predictionresidual signals.

The prediction residual signals are DCTed by the DCT 3. The DCTedsignals are given to the quantizer 4. The quantizer 4 quantizes theDCTed signals according to quantization control data (quantization stepwidth) inputted by the quantize controller 6. These quantized signalsare inputted to the variable length coder 7 and the local decoder 8.

In the local decoder 8, the quantized signals are inversely quantizedand further inversely DCTed, that is, the codes are decoded asreproduced prediction residual signals. The decoded signals are inputtedto the adder 9. In the adder 9, the inter-frame prediction signalsinputted by the inter-picture predictor 10 and the reproduced predictionresidual signals inputted by the local decoder 8 are added to each otheras reproduced picture signals. The reproduced picture signals aresupplied to the inter-picture predictor 10.

In the inter-picture predictor 10, the reproduced picture signals aredelayed by one frame for motion compensation to generate inter-frameprediction signals. The generated inter-frame prediction signals aresupplied to the predict subtracter 2 and the adder 9.

In the activity detector 5, the degree of change of the picture data isdetected on the basis of the dispersion of pixel values, the absoluteaddition of the prediction error values, the absolute addition oforthogonal transform coefficients, etc. Further, the data (necessarywhen the quantization step width is to be decided by the quantizecontroller 6) are generated according to the detected degree of changeof the picture data for each of the sequential blocks (e.g., 8×8 pixels)partitioned from the picture signals. The generated data are supplied tothe quantize controller 6.

Further, the sequential blocks partitioned from the picture signals arecollected as a picture, and a plurality of pictures are collected as apicture unit GOP composed of a group of pictures, as depicted in FIG. 7.

To the quantize controller 6, a reference quantization step width (apredetermined fixed value) is inputted through the selector 18 switchedto the a-side. Further, the data used to set the quantization step widthis supplied from the activity detector 5 to the quantize controller 6.

On the basis of these data, in the case of a picture whose picturecontents change violently, the quantization step width is set to a largevalue by the quantize controller 6. Further, in the case of a picturewhose picture contents change slightly, the quantization step width isset to a small value by the quantize controller 6. .[.<Total code amountcontrol>.].

.Iadd.Total Code Amount Control .Iaddend.

The variable length coder 7 codes the signals quantized by the quantizer4 in way of variable length, and outputs the coded data whose dataamount is compressed.

The data coded by the variable length coder 7 are inputted to thetemporal code amount counter 19 via the selector 11 switched to thea-side.

FIG. 6 shows a practical construction of the temporal code amountcounter 19. In FIG. 6, the temporal code amount counter 19 comprises ablock code amount counter 30, a picture code amount counter 31, a GOPcode amount counter 32, a block end detector 33 for detecting an end ofeach block, a picture end detector 34 for detecting an end of eachpicture, and a GOP end detector 35 for detecting an end of each GOP.

To a terminal 29 of the temporal code amount counter 19, coded data ofthe sequential blocks are supplied from the variable length coder 7through the selector 11 switched to the a-side. The supplied coded dataare inputted to the block code amount counter 30.

On the basis of the coded data supplied to the block code amount counter30, the code amount for each of the sequential blocks is counted by theoperation of both the block code amount counter 30 and the block enddetector 33, to generate the code amount data for each of the sequentialblocks.

The counted code amount data for the blocks are sequentially inputted toand stored in the block temporal code amount memory 36 of the temporalcode amount memory 20 via a transmission line 41. Further, the codeamount data for each block is read from the temporal block code amountmemory 36, and then inputted to the picture code amount counter 31 ofthe temporal code amount counter 19 through a line 43.

On the basis of the coded data supplied to the picture code amountcounter 31, the code amount for each of sequential pictures is countedby the operation of both the picture code amount counter 31 and thepicture end detector 34, to generate the sequential code amount data forthe pictures.

The counted code amount data for the pictures are sequentially inputtedto and stored in the picture temporal code amount memory 37 of thetemporal code amount memory 20 via a transmission line 40. Further, thecode amount data for each picture is read from the picture temporal codeamount memory 37, and then inputted to the GOP code amount counter 32 ofthe temporal code amount counter 19 through a line 42.

On the basis of the coded data supplied to the GOP code amount counter32, the code amount for each of sequential GOPs is counted by theoperation of both the GOP code amount counter 32 and the GOP enddetector 35, to generate the sequential code amount data for the GOPs.

The counted code amount data for the GOPs are sequentially inputted toand stored in the GOP temporal code amount memory 38 of the temporalcode amount memory 20 via a transmission line 39.

The code amount data stored in the temporal code amount memory 20 (i.e.,block temporal code amount memory 36, the picture temporal code amountmemory 37 and the GOP temporal code amount memory 38) as described aboveare read therefrom at the second coding of the picture signals suppliedfrom the picture signal source 1.

Further, in FIG. 6, the temporal code amount counter 19 and the temporalcode amount memory 20 are constructed in such a way that the codeamounts of three stages (block, picture and GOP) are counted separatelyby the temporal code amount counter 19 and further stored separately inthe temporal code amount memory 20. Without being limited thereto, it isalso possible to separate the code amounts to five-stage hierarchiessuch as block, macro-block, slice, picture and GOP and to count andstore the respective code amounts of the five stages, separately, aswith the case of the ISO 11172-2 (International Standard of MotionPicture). In more general expression, it is possible to separate, countand store the code amount into N-stage hierarchies (N: a positiveinteger), individually.

Further, at the first coding of the picture signals supplied from thepicture signal source 1, the sequential temporal code amount data of theGOPs outputted from the temporal code amount counter 19 through the line39 are supplied to the code amount converter 113 and converted intotarget code amount data in accordance with the conversioncharacteristics stored therein. FIG. 12 shows an example of the codeamount converter 113.

Here, when the temporal code amounts of the sequential GOPs (groups ofpictures each composed of a plurality of pictures) supplied from thetemporal code amount counter 19 to the code amount converter 113 at thefirst coding are denoted by T1i (i designates a numeral from 1 to nindicative of the order of the sequential GOPs), and when the targetcode amounts obtained by converting the temporal code amounts T1i on thebasis of the conversion characteristics fg of the code amount converter113 are denoted by T2i, the relationship between T2i, fg and T1i can beexpressed by the following formula:

    T2i=fg (T1i)                                               (1)

Further, as the conversion characteristics fg, it is possible to use thecharacteristics obtained on the basis of the ratio of the total temporalcode amount S1 to the target code amount S2 at the second codingoperation as expressed by the following formula (e.g., as shown in FIG.8):

    fg (x)=k·S1/S2·x                         (2)

where k is a constant (k>0).

Further, since the picture quality deteriorates with decreasing amountof generated codes of the GOP, it is also preferable to use theconversion characteristics such that a large code amount can bedetermined when the amount of the generated codes is small, as expressedby the following formula (e.g., as shown in FIG. 9):

    fg (x)=a·x·b                             (3)

where denotes the power, and a and b denote a constant, respectively(a >0, 0 <b <1).

Further, the upper limit of the target code amounts T2i is determined bythe capacity of the recording medium for recording coded data or therestriction of the decoding apparatus.

A plurality of the converters 161 to 164 of the code amount converter113 shown in FIG. 12 are provided with mutually different conversioncharacteristics fg1, fg2, fg3, . . . (FIGS. 8 and 9 show an example ofthe conversion characteristics) so that different target code amountscan be outputted on the basis of the temporal code amounts inputtedthereto. Further, as the target total code amount to be set, the totalcapacity of the recording medium used to record the coded data obtainedby coding the picture signals can be used, for instance.

Therefore, the same coded data of the same picture signals are suppliedfrom the input terminal 158 to the n-units of the circuit arrangementsof the converter 161, the accumulate adder 165 and the comparator 169;the converter 162, the accumulate adder 166 and the comparator 170; theconverter 163, the accumulate adder 167 and the comparator 171; . . . ;and the converter 164, the accumulate adder 168 and the comparator 172of the code amount converter 113.

That is, the temporal code amount data of the sequential GOPs asdescribed above are converted by the n-units of the converters 161 to164 having different conversion characteristics to obtain the differentconverted code amount data which is determined on the basis of therecordable capacity of the recording medium. The different convertedcode amount data for each GOP are added by the n-units of the differentaccumulate adders 165 to 168, respectively to obtain the n-units of thedifferent accumulated code amount data for the whole picture signals.The n-units of the different accumulated coded data are compared withthe determined target total code amount. Therefore, the n-units of theoutputs of the n-unit comparators 169 to 172 have different comparisonresults with respect to the same determined target total code amount,respectively.

The discriminator 173 discriminates or selects the conversioncharacteristics for converting the temporal code amount for the wholepicture signals into the maximum code amount, from among the n-unitoutputs of the comparators 169 to 172 provided separately in the codeamount converter 113, within a range of the same set target total codeamount. The transfer rate data corresponding to the discriminatedconversion characteristics discriminated as above are given to thetarget transfer rate setter 15 of FIG. 5 through an output terminal 159..[.<Actual coding>.].

.Iadd.Actual Coding .Iaddend.

In FIG. 5, the section enclosed by B serves the actual coding, by whichthe picture signals the same as used for the first coding (temporalcoding) already explained are outputted from the picture signal source 1for the second coding. In this case, the two selectors 11 and 18 areboth switched to the b-side, respectively and the switch 26 is turnedon.

At the second coding, the picture signals outputted by the picturesignal source 1 are inputted to the predict subtracter 2 and theactivity detector 5, in the same way as with the case of the firstcoding already explained.

In the predict subtracter 2, the inter-frame prediction signal inputtedby the inter-picture predictor 10 is subtracted from the picturesignals, and the subtracted results are inputted to the orthogonalconverter 3 as the prediction residual signals.

Further, in the same way as with the case of the first coding, theprediction residual signals are DCTed (discrete cosine transformed) bythe orthogonal converter 3, and then introduced to the quantizer 4. Inthe quantizer 4, the DCTed prediction signals are quantized inaccordance with the quantization control data (quantization step width)inputted by the quantize controller 6. These quantized signals areinputted to the variable length coder 7 and the local decoder 8,respectively.

Further, in the same way as with the case of the first coding, thequantized signals are inversely quantized and further inversely DCTed bythe local decoder 8, the decoded signals are inputted to the adder 9 asthe reproduced prediction residual signals. In the adder 9, theinter-frame prediction signals inputted from the inter-picture predictor10 and the reproduced prediction residual signals inputted from thelocal decoder 8 are added, and then supplied to the inter-picturepredictor 10 as the reproduced picture signals.

Further, in the same way as with the case of the first coding, in theinter-picture predictor 10, the reproduced picture signals are delayedby one frame for motion compensation to generate the inter-frameprediction signals. The generated inter-frame prediction signals aresupplied to the prediction subtracter 2 and the adder 9.

In the activity detector 5, in the same way as at the first coding, datafor setting the quantization step width to be decided by the quantizecontroller 6 are generated in correspondence to the change rate of thepicture data for each sequential block (e.g., 8×8 pixels) partitioned bythe picture signals. The generated data are supplied to the quantizecontroller 6.

To the quantize controller 6, data used for setting the quantizationstep width to be supplied in correspondence to the first block of eachpicture are supplied from the quantize scale setter 25 through theselector 18 switched to the b-side in the second coding. Further, in theperiod during which the data for setting the quantization step width isnot supplied from the quantize scale setter 25 to the quantizecontroller 6, data for setting the quantization step width are suppliedfrom the code amount comparator 24 (as shown in FIG. 11 in practice) tothe quantize controller 6 via the switch 26.

The coded data outputted from the coder 7 at the second coding areinputted to and written in the buffer 16 in sequence and also inputtedto the code amount comparator 24 via the selector 11 switched to theb-side. Further, the coded data written in the buffer 16 are read at aread speed determined on the basis of the transfer rate data inputtedfrom the target transfer rate setter 15, as the coded data of variabletransfer rate. The obtained coded data are outputted to another decodingapparatus (not shown) from the coded data output terminal 28.

Further, in the code amount comparator 24, target code amount datainputted from the target code amount memory 23 (described later) and thecode amount of the coded data at the second coding are compared tooutput data (quantization step width control data) used for setting thequantization step width. The outputted data is supplied to the quantizecontroller 6 via the switch 26.

The quantization step width control data are inputted to the quantizecontroller 6 from the activity detector 5, the quantize scale setter 25,and the code amount comparator 24, respectively, in order that themaximum total code amount of the coded data for the whole picturesignals can be determined within the range less than the target totalcode amount (e.g., the total memory capacity of the recording mediumused to record the coded data of the whole picture) at the secondcoding.

Further, in the quantize step width setter 25, the quantization stepwidth control data are generated for only the first block of eachpicture. In the code amount comparator 24, the quantization step widthcontrol data are generated for each block used when the quantize stepwidth setter 25 does not generate the quantization step width controldata.

In the code amount comparator 24, the target code amount data suppliedfrom the target code amount memory 23 are compared with the code amountfor each block (obtained by detecting the code amount of the coded dataoutputted by the variable length coder 7 at the second coding), andgenerates the quantization step width control data for each block usedwhen the quantize step width setter 25 does not generate thequantization step width control data.

FIG. 11 is a block diagram showing an actual example of the code amountcomparator 24.

In FIG. 11, the coded data outputted from the variable length coder 7are inputted to a terminal 47. Further, the target code amount data foreach of the sequential blocks is inputted from the target code amountmemory 23 to a terminal 49. The data inputted to the terminal 49 isinputted to a subtracter 54 as a minuend.

A block code amount detector 21 detects the code amount for each of thesequential blocks on the basis of the coded data inputted to theterminal 47. The detected code amount data for each block is inputted toa subtracter 54 as a subtrahend.

The subtracter 54 subtracts the code amount data (subtrahend) for eachblock from the target block code amount data (minuend) for each block.The subtracted results are inputted to two comparators 55 and 56. Apositive threshold value set to a threshold value setter 51 is inputtedto the comparator 55, and a negative threshold value set to a thresholdvalue setter 50 is inputted to the comparator 56.

When the output of the subtracter 54 is positive (i.e., the target blockcode amount is larger than the generated block code amount and furtherlarger than the positive threshold value set in the threshold valuesetter 51), a comparison result of the comparator 55 is inputted to adiscriminator 57. On the other hand, when the output of the subtracter54 is negative (i.e., the target block code amount is smaller than thegenerated block code amount and further smaller than the negativethreshold value set in the threshold value setter 50), a comparisonresult of the comparator 56 is inputted to the discriminator 57.

Further, when the output of the subtracter 54 lies between the positivethreshold value set to the threshold value setter 51 and the negativethreshold value set to the threshold value setter 50, that is, when adifference between the target block code amount and the generated blockcode amount is less than a predetermined value, the outputs of both thecomparators 55 and 56 are set to zero. The discriminator 57 outputs thequantization step width control data for each block to the quantizecontroller 6 via the output terminal 48 and the switch 26.

When the two outputs of the two comparators 55 and 56 are both zero, thequantization step width control data inputted from the discriminator 57to the quantize controller 6 as described above dose not change thequantization step width. Further, when the target block code amount islarger than the generated block code amount and thereby the comparisonresult of the comparator 55 is inputted to the discriminator 57, thecontrol data decreases the quantization step width. Further, when thetarget block code amount is smaller than the generated block code amountand thereby the comparison result of the comparator 56 is inputted tothe discriminator 57, the control data increases the quantization stepwidth.

On the basis of the reference quantization step width (a predeterminedfixed value) and the picture code amount data supplied by the targetcode amount memory 23, the quantize step width setter 25 generates thequantization step width control data for the first block of eachpicture, and inputs the generated control data to the quantizecontroller 6 via the selector 18. The quantize comparator 24 generatesthe quantization step width control data for each block when thequantize step width setter 25 does not generates the quantization stepwidth data, and the generated control data are inputted to the quantizecontroller 6 via the switch 26. The switch 26 is turned on only when thequantization step width control data are transmitted.

The quantize step width setter 25 and the code amount comparator 24generate the quantization step width control data by use of the targetcode amount data supplied by the target code amount memory 23. Thetarget code amount data stored in the target code amount memory 23 canbe obtained by converting the code amount data for each block and thecode amount data for each picture of the picture signals stored in thetemporal code amount memory 20 into the target code amounts by theconverter 22.

Now, the code amount data obtained by the temporal code amount counter19 at the first coding (i.e., the code amount data for each block, thecode amount data for each picture, and the code amount data for eachpicture unit (GOP) composed of a plurality of pictures of picturesignals) have been stored in the temporal code amount memory 20. Thedata for each GOP of these code amount data are given also to the codeamount converter 113. The given data are used to decide the code amountconversion characteristics for converting a plurality of the temporalcode amount data for each GOP in such a way that the maximum total codeamount of the coded data of the whole picture signals can be obtainedwithin the range less than the target total code amount (e.g., the totalmemory capacity of the recording medium used to record the coded data ofthe whole picture signals), as already explained with reference to FIG.12.

As described above, when the data of the temporal code amount T1i (idenotes numerals 1 to n indicative of the order of the sequential GOPs)obtained at the first coding are supplied to the code amount converter113, the code amount converter 113 decides the code amount conversioncharacteristics fg so that the total code amount of the coded data ofthe whole picture signals becomes the maximum total code amount data T2(target code amount) within the target total code amount (e.g., thetotal memory capacity of the recording medium used to record the codeddata of the whole picture signals). The code amount converter 113supplies the target code amount T2i (i denotes numerals 1 to nindicative of the order of the sequential GOPs) to the target transferrate setter 15. The supplied data T2i are stored in the target transferrate setter 15.

As described above, in the second coding stage, the code amount data isstored in the target transfer rate setter 15 in such the state that thetemporal code amount T1i for each GOP is converted into the target codeamount T2i. In addition, the temporal code amount data for eachsequential block, the temporal code amount data for each sequentialpicture, and the temporal code amount data for each GOP have been storedin the temporal code amount memory 20. Further, the target code amountT2i for each GOP stored in the target transfer rate setter 15 has beenobtained by converting the temporal code amount T1i generated at thefirst coding by the code amount converter 113 in accordance withappropriate conversion characteristics fg.

The above-mentioned appropriate conversion characteristics fg can beobtained from the formula (1) as

    fg (x)=T2(i)/T1(i)·x

where i denotes numerals 1 to n indicative of the order of thesequential GOPs.

That is, at the second coding of the coding apparatus according to thepresent invention, data of the target code amount T2i of each GOP storedin the target transfer rate setter 15, the temporal code amount for eachblock stored in the temporal code amount memory 20, the temporal codeamount for each picture stored in the memory 20, and the temporal codeamount for each GOP stored in the memory 20 are all supplied to thetarget code amount converter 22. The target code amount converter 22converts the code amount data for each block and for each picture storedin the temporal code amount memory 20 into the target code amount datafor each block and for each picture. These data are once stored in thetarget code amount memory 23, thereafter, the necessary data of thesestored data are supplied to the quantize scale setter 25 and the codeamount comparator 24.

FIG. 10 is an illustration for assistance in explaining the operation ofthe converter 22 for converting the temporal code amount for each blockand the temporal code amount for each picture into the predeterminedtarget code amounts having the relationship T2/T1, where the temporalGOP code amount is denoted by T1(i) and the target GOP code amount isdenoted by T2(i).

In FIG. 10, Tp1(0), Tp1(1), . . . denote the temporal code amounts ofthe sequential pictures, and Tp2(0), Tp2(1), . . . denote the targetcode amounts of the sequential pictures. In this example, FIG. 10indicates that the temporal code amount T1(i) of one GOP can beconverted into the target code amount T2(i) of one GOP, where thetemporal code amounts of a plurality of pictures for constituting oneGOP having the temporal code amount T1(i) are denoted by Tp1(0), Tp1(1),. . . .

In other words, when the code amounts are converted in accordance withthe conversion characteristics expressed by fg=T2(i)/T1(i), the temporalcode amounts Tp1(0), Tp1(1), . . . of the sequential pictures forconstituting the single GOP are also converted in accordance with theconversion characteristics expressed by fg=T2(i) /T1(i), with the resultthat the target code amounts of the sequential pictures can be expressedas Tp2(0), Tp2(1),

Further, in FIG. 10, Tb1(0), Tb1(1), . . . denote the temporal codeamounts of the sequential blocks, and Tb2(0), Tb2(1), . . . denote thetarget code amounts of the sequential blocks. FIG. 10 indicates that thetemporal code amount Tp1(i) of one picture can be converted into thetarget code amount Tp2(i) of one picture, where the temporal codeamounts of a plurality of blocks for constituting one picture having thetemporal code amount Tp1(i) are denoted by Tb1(0), Tb1(1) . . . .

In other words, when the code amounts are converted in accordance withthe conversion characteristics expressed byfg=Tp2(i)/Tpl(i)=T2(i)/T1(i), the temporal code amounts Tb(0), Tb1(1), .. . of the sequential blocks for constituting the single picture arealso converted in accordance with the conversion characteristicsexpressed by fg=Tp2(i) /Tpl(i)=T2(i) /T1(i), with the result that thetarget code amounts of the sequential blocks can be expressed as Tb2(0),Tb2(1),

Further, in the conversion characteristics of the target code amountconverter 22 shown in FIG. 10, although the ratio of the temporal codeamount to the target code amount of the upper hierarchy is applied tothe lower hierarchy so as to be divided in proportional relationship.Without being limited only thereto, it is also possible to adopt theweighted division in accordance with the formula (3) as alreadydescribed.

In the coding apparatus according to the present invention, since thecode amounts can be divided appropriately so that the picture qualitycan be equalized, it is possible to improve the picture quality. Inaddition, since the fluctuations in quantization step width due to thequantization step width control operation can be reduced whenever achanges, it is possible stabilize the picture quality in theintra-frames and inter-frames, while reducing the average code amounts.

What is claimed is:
 1. A variable transfer rate coding apparatus forcoding moving picture signals of .Iadd.a plurality of .Iaddend.groups ofpictures, comprising:a quantizer for quantizing the .Iadd.moving.Iaddend.picture signals under control of quantization step width pergroup of pictures; a coder for coding the quantized picture signals.Iadd.per group of pictures.Iaddend., the coding being executed .[.twiceper group of pictures.]. by a first coding and a second coding.Iadd.executed after the first coding.Iaddend.; code amount obtainingmeans for obtaining a first code amount of the coded picture signals pergroup of pictures coded by the first coding and a second code amount of.Iadd.the coded picture signals per .Iaddend.picture .[.data.]. .Iadd.orblock-unit obtained by dividing the picture .Iaddend.included .[.per.]..Iadd.in each .Iaddend.group of pictures .Iadd.coded by the firstcoding.Iaddend.; first determining means, in response to the first codeamount, for calculating a .Iadd.temporal .Iaddend.total code amount ofthe .Iadd.moving .Iaddend.picture signals of the .Iadd.plurality of.Iaddend.groups of pictures and comparing the .Iadd.temporal.Iaddend.total code amount with a reference total code amount, to decidea first target code amount .Iadd.for the second coding .Iaddend.pergroup of pictures in order that .[.the total code amount.]. .Iadd.atotal code amount obtained by calculating the first target code amount.Iaddend.becomes a maximum amount within the reference total codeamount; second determining means, in response to the first target codeamount and the second code amount, for determining a second target codeamount .[.of.]. .Iadd.for .Iaddend.the .[.picture data.]. .Iadd.secondcoding per the picture or the block-unit .Iaddend.included in each groupof pictures in accordance with the maximum amount .Iadd.of the totalcode amount.Iaddend.; and control means for varying the quantizationstep width on the basis of the second target code amount for the secondcoding by the coder.
 2. The variable transfer rate coding apparatus ofclaim 1, wherein the code amount obtaining means comprises:firstcounting means, in response to the coded picture signals per group ofpictures, for sequentially counting code amounts of blocks per picture;second counting means, in response to the code amounts of blocks, forsequentially counting code amounts of pictures in each group; and thirdcounting means, in response to the code amounts of pictures, forcounting the first code amounts, wherein at least either of a codeamount of a block or a picture is obtained as the second code amount. 3.The variable transfer rate coding apparatus of claim 1, wherein thefirst determining means comprises:converting means for sequentiallyconverting the first code amount per group of pictures into differentcode amounts by means of different conversion characteristics;accumulating means for accumulating each different code amount per groupof pictures over the groups of pictures to generate different total codeamounts of the groups of pictures under the different conversioncharacteristics; comparing means for comparing each of the differenttotal code amounts with the maximum total code amount; and thirddetermining means for determining which one of the different total codeamounts is the largest and the closest to the maximum total code amount,to output one of the conversion characteristics corresponding to thedetermined total code amount as the first target code amount.[., thusthe second determining means converting the second code amount into thesecond target code amount by means of the outputted conversioncharacteristics.]..
 4. The variable transfer rate coding apparatus ofclaim 1 further comprising comparing means for comparing the first codeamount with the second target code amount to output quantization stepwidth information for each block of a picture, thus the control meansvarying the quantization step width on the basis of the quantizationstep width information.
 5. The variable transfer rate coding apparatusof claim 4, wherein the comparing means comprises:detecting means, inresponse to the coded picture signals, for detecting a code amount ofeach block; subtracting means for subtracting the detected code amountfrom the second target code amount; first comparing means for comparinga subtraction result of the subtracting means with a reference positivevalue and outputting a first comparison signal when the subtractionresult is positive and .[.grater.]. .Iadd.greater .Iaddend.than thereference positive value; second comparing means for comparing thesubtraction result with a reference negative value and outputting asecond comparison signal when the subtraction result is negative and.[.grater.]. .Iadd.greater .Iaddend.than the reference negative value;and means, in response to the first comparison signal, for outputting afirst quantization step width information, thus the control meansnarrowing the quantization step width, while in response to the secondcomparison signal, for outputting a second quantization step widthinformation, thus the control means widening the quantization stepwidth.